package com.yanqu.road.server.cmd.wingroom.message;

import com.yanqu.road.pb.wingroom.WingRoomProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;
import io.netty.channel.ChannelHandlerContext;

/**
 * @author ：zfr
 * @date ：2022/3/19 22:11
 */
@Cmd(code = CrossProtocol.C_WING_ROOM_GET_MESSAGE_BOARD_RESP, desc = "获取留言板返回")
public class CrossGetMessageBoardRespCmd implements Command {
    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        WingRoomProto.GetMessageBoardRespCrossMsg respCrossMsg = WingRoomProto.GetMessageBoardRespCrossMsg.parseFrom(packet.getBytes());
        YanQuMessage message = YanQuMessageUtils.buildMessage(ClientProtocol.U_WING_ROOM_GET_MESSAGE_ALL_DATA, respCrossMsg.getRespMsg());
        MessageHelper.sendPacket(respCrossMsg.getGuestServerId(), respCrossMsg.getGuestUserId(), message);
    }
}
